<?php
    class Default_Model_Tag extends Zend_Db_Table_Abstract
    {
        protected $_db;
		
		public function __construct()
		{
			$this->_db = Zend_Registry::get('db');
		}
        
        public function getTagNameById($id, $locale)
        {
            $sql = $this->_db->select()
                            ->from('tag_language AS tl', array('name'))
                            ->join('language AS l', 'l.id = tl.language_id', null)
                            ->where('tl.tag_id = ?', $id)
                            ->where('l.locale = ?', $locale);
            $result = $this->_db->fetchOne($sql);
            return $result;
        }
    }
